package com.cy.web.controller;

import com.cy.Pojo.Log;
import com.cy.service.LogService;
import com.cy.web.pojo.LogResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/log/")
public class LogController {
    @Autowired
    private LogService logService;
    @GetMapping
    public LogResult dofindLog(Log log){
            return new LogResult(logService.findLog(log));
    }
    @PostMapping
    public LogResult dosaveLog(@RequestBody  Log log){
        logService.saveLog(log);
        return new LogResult("Save Ok");
    }
    @GetMapping("{id}")
    public LogResult dofindId(@PathVariable  Long id) {
       // try {
            return new LogResult(logService.findLogById(id));
      //  }catch (Exception e){
       //    return  new LogResult("此记录已经被删除");
       // }
    }
    @DeleteMapping("{id}")
    public LogResult dodeleteLog(@PathVariable  int...id){
        logService.deleteLog(id);
        return new LogResult("delete Ok");
   }




}
